package com.nce.entity;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;


/**
 *新闻 * 
 * @author GT
 */
@Entity
@Table(name = "news")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class News extends BaseNews {

	private static final long serialVersionUID = 7589108853815428562L;
	
	/*
	  CREATE TABLE `news` (
	  `id` int(11) NOT NULL auto_increment,
	  `title` varchar(255) default NULL,#标题
	  `content` mediumtext,#内容
	  `url` varchar(255) default NULL,#链接
	  `tm_post` datetime default NULL,#发文时间
	  `forum_name` varchar(255) default NULL,#网站名
	  `uid` mediumint(9) default NULL,#文章所属的用户
	  `tm_spider` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
	  `tm_last_rply` datetime default NULL,
	  `Is_New ` varchar(255) default NULL,#新文章标志
	  `Has_Export` varchar(255) default NULL,#导出标志  
	  PRIMARY KEY  (`id`)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8;

	 */
	
	
	private Date tmLastRply;
	private Long forwardCnt;
	
	//String result = "发文人,微博内容,发文时间,来源,转发数,评论数,收藏数,\r\n";
	public String formatForExport(){
		StringBuilder sb = new StringBuilder();
		sb.append("\"").append(getTitle()).append("\",");
		sb.append("\"").append(getUrl()).append("\",");
		sb.append("\"").append(getForumName()).append("\",");
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		sb.append("\"").append(df.format(getTmPost())).append("\",");
		sb.append("\"").append(getContent()).append("\",");
		sb.append(getForwardCnt()).append(",");
		sb.append("\r\n");
		return sb.toString();
	}
	
	
	

	



	@Override
	public String toString() {
		return "News [getTitle()=" + getTitle() + ", getContent()="
				+ getContent() + ", getUrl()=" + getUrl() + ", getTmPost()="
				+ getTmPost() + ", getForumName()=" + getForumName()
				+ ", getUser()=" + getUser() + ", getTmSpider()="
				+ getTmSpider() + ", getTmLastRply()=" + getTmLastRply()
				+ ", getIsNew()=" + getIsNew() + ", getHasExport()="
				+ getHasExport() + ", toString()=" + super.toString()
				+ ", getId()=" + getId() + ", getClass()=" + getClass()
				+ ", hashCode()=" + hashCode() + "]";
	}




	




	public Date getTmLastRply() {
		return tmLastRply;
	}




	public void setTmLastRply(Date tmLastRply) {
		this.tmLastRply = tmLastRply;
	}








	public Long getForwardCnt() {
		return forwardCnt;
	}








	public void setForwardCnt(Long forwardCnt) {
		this.forwardCnt = forwardCnt;
	}


	


}
